<?php
$paymentMode = array('' => 'Select Payment Mode...', 'Cash' => 'Cash', 'Cheque' => 'Cheque', 'Credit Card' => 'Credit Card');
$relationMode = array('' => 'Select Relationship to Applicant...', 'Father of' => 'Father', 'Mother of' => 'Mother', 'Guardian of' => 'Guardian');
$creditcardname = array('' => 'Select Credit Card Name', 'Visa' => 'Visa', 'Master' => 'Master', 'Amex' => 'Amex', 'Debit' => 'Debit');
if($payee != FALSE){
	$firstname = set_value('firstname',$payee->firstname);
	$middlename = set_value('middlename',$payee->middlename);
	$lastname = set_value('lastname',$payee->lastname);
	$name_ext = set_value('name_ext',$payee->name_ext);
	$relation = set_value('relation',$payee->relation);
}else{
	$firstname = set_value('firstname','');
	$middlename = set_value('middlename','');
	$lastname = set_value('lastname','');
	$name_ext = set_value('name_ext','');
	$relation = set_value('relation','');
}
//var_dump($payee);
?>

<style>
	input#amount_money
	{
		padding:10px 20px;
		font-size:30px;
		font-family:DigitaldreamFatNarrowRegular;
		text-align:right;
		width:266px;
	}
	
	.ui-menu .ui-menu-item a{
			font-size:11px;
			font-weight:bold;
	}
	.ui-autocomplete.source:hover {
		background: #454545;
	}
	.ui-autocomplete-loading {
    background: white url('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/images/ui-anim_basic_16x16.gif') right center no-repeat;
  }
</style>
<div class="row structured">
	<div class="panel"><h6>Payment Center for Reservation</h6></div>
	<div class="large-12 columns">
	<div class="panel">
	<?if(isset($system_message))echo $system_message;?>
	<?if(isset($structuredvalidationerror)):?>
			<?=$structuredvalidationerror;?>
	<?endif?>
	
	
	<?echo form_open('fees/registration_fee/'.$student->enrollment_id,'class="custom" autocomplete="off""');?>
	
	<div class="row collapse">
		<span style="font-size:10px; color:red; display:none;" id="firstname_notice">Payee's Name cannot be blank or must be complete. Required entry.</span>
		<div class="small-4 large-4 columns">
			<span class="prefix">Payee</span>
		</div>
		<div class="small-3 large-3 columns">
			<input type="text" id="firstname" name="firstname" autocomplete="off" placeholder="First Name" value="<?php echo ucwords(strtolower($firstname)); ?>" class="postfix">
		</div>
		<div class="small-2 large-2 columns">
			<input type="text" id="middlename" name="middlename" autocomplete="off" placeholder="Middle Name" value="<?php echo ucwords(strtolower($middlename)); ?>" class="postfix">
		</div>
		<div class="small-2 large-2 columns">
			<input type="text" id="lastname" name="lastname" autocomplete="off" placeholder="Last Name" value="<?php echo ucwords(strtolower($lastname)); ?>" class="postfix">
		</div>
		<div class="small-1 large-1 columns">
			<input type="text" id="name_ext" name="name_ext" autocomplete="off" placeholder="Jr, II etc"value="<?php echo $name_ext=='jr' || $name_ext == 'sr' ? ucwords(strtolower($name_ext)):strtoupper($name_ext); ?>" class="postfix">
		</div>
	</div>

	<div class="row collapse">
		<span style="font-size:10px; color:red; display:none;" id="relation_notice">Choice a Relation. Required entry.</span>
		<div class="small-4 large-4 columns">
			<span class="prefix">Relationship to Applicant</span>
		</div>
		<div class="small-8 large-8 columns">
			<?php echo form_dropdown('relation', $relationMode, $relation, 'id="relation"');?>
		</div>
	</div>

	<div class="row collapse">
		<div class="small-4 large-4 columns">
			<span class="prefix">Student Name</span>
		</div>
		<div class="small-8 large-8 columns">
			<div class="ui-widget">
			<input class="searchInput" type="text" name="student" value="<?php echo ucwords(strtoupper($student->firstname)); ?> <?php echo $student->firstname!=''? ucwords(strtoupper($student->middlename)).' ':''; ?><?php echo ucwords(strtoupper($student->lastname)); ?> <?php echo $student->name_ext=='jr' || $student->name_ext == 'sr' ? ucwords(strtolower($student->name_ext)):strtoupper($student->name_ext); ?>" disabled="disabled">
			<input type="hidden" name="student" value="<?php echo $student->enrollment_id; ?>">
			</div>
		</div>
	</div>

	<div class="row collapse">
		<span style="font-size:10px; color:red; display:none;" id="spr_or_no_notice">Payment OR number cannot be blank. Required entry.</span>
		<div class="small-3 large-2 columns">
			<span class="prefix">OR Number</span>
		</div>
		<div class="small-9 large-10 columns">
			<input type="text" id="spr_or_no" name="spr_or_no" autocomplete="off" placeholder="Payment OR Number" value="<?php echo set_value('spr_or_no');?>">
		</div>
	</div>
	
	<div class="row collapse">
		<div class="small-3 large-2 columns">
			<span id="amount_money" class="prefix">&#8369;</span>
		</div>
		<div class="small-9 large-10 columns">
			<input id="amount_money" autocomplete="off" type="text" name="ammount_paid" placeholder="Amount" value="<?php echo set_value('ammount_paid');?>">
		</div>
	</div>
	
	<div class="row collapse">
		<div class="small-3 large-2 columns">
			<span class="prefix">Date of Payment</span>
		</div>
		<div class="small-9 large-10 columns">
			<input type="text" name="date_of_payment" autocomplete="off"  placeholder="MM/DD/YYY " class ="datepicker-payment" value="<?php echo set_value('date_of_payment',$current_time);?>">
		</div>
	</div>

	<div class="row collapse">
		<div class="small-3 large-2 columns">
			<span class="prefix">Cheque No.</span>
		</div>
		<div class="small-9 large-10 columns">
			<input type="text" id="cheque_no" name="cheque_no" autocomplete="off" placeholder="Cheque Number">
		</div>
	</div>

	<div class="row collapse">
		<div class="small-3 large-2 columns">
			<span class="prefix">Credit Card No.</span>
		</div>
		<div class="small-9 large-10 columns">
			<input type="text" id="credit_card_no" name="credit_card_no" autocomplete="off" placeholder="Credit Card Number">
		</div>
	</div>

	<div class="row collapse">
		<div class="small-3 large-2 columns">
			<span class="prefix">Credit Card Name</span>
		</div>
		<div class="small-9 large-10 columns">
			<?php echo form_dropdown('credit_card_name', $creditcardname, set_value('credit_card_name'));?>
		</div>
	</div>

	<div class="row collapse">
		<span style="font-size:10px; color:red; display:none;" id="spr_payment_mode_notice">Select a Payment Method. Required entry.</span>
		<div class="small-3 large-2 columns">
			<span class="prefix">Type of Payment</span>
		</div>
		<div class="small-9 large-10 columns">
			<?=form_dropdown('payment_type',array(''=>'-- choose type --','cash'=>'Cash','check/cheque'=>'Check/Cheque','credit'=>'Credit Card','other settlement'=>'Other Settlement'),set_value('payment_type'),'id="payment_mode"');?>
		</div>
	</div>
	
	<div class="input-block">
		<label>Remarks</label>
		<textarea name="remarks"><?php echo set_value('remarks','','autocomplete="off"');?></textarea>
	</div>

	<div class="input-block">
	<?php
		echo form_label('Select Section', 'section_id');
		echo form_dropdown('section_id', $sections, $student->e_section_id);
	?>
	</div>

	<input type="hidden" name="loc_sdi" value="<?echo $token;?>">
	<input type="submit" class="button tiny" id="update_fee" name="add_payment_record" value="Add Payment Record">
	</form>
	</div>
	</div>
</div>

<script>
	$('#update_fee').bind('click submit', function(event){
		if($('#spr_or_no').val()!='' && $('#spr_or_no').val()!=' '){
			$("#spr_or_no_notice").css({ display: "none" });
		}else{
			$("#spr_or_no_notice").css({ display: "block" });
		}

		if($('#payment_mode').val()!=''){
			$("#spr_payment_mode_notice").css({ display: "none" });
		}else{
			$("#spr_payment_mode_notice").css({ display: "block" });
		}

		if($('#firstname').val()!=''){
			$("#firstname_notice").css({ display: "none" });
		}else{
			$("#firstname_notice").css({ display: "block" });
		}

		if($('#lastname').val()!=''){
			$("#firstname_notice").css({ display: "none" });
		}else{
			$("#firstname_notice").css({ display: "block" });
		}

		if($('#relation').val()!=''){
			$("#relation_notice").css({ display: "none" });
		}else{
			$("#relation_notice").css({ display: "block" });
		}
	  
		if($('#spr_or_no').val()=='' || $('#spr_or_no').val()==' ' || $('#payment_mode').val()=='' || $('#firstname').val()==' ' || $('#firstname').val()==''|| $('#lastname').val()==' ' || $('#lastname').val()==''|| $('#relation').val()==''){
			event.preventDefault();
		}
	});
</script>